import request from '@/utils/request'

export default {
  //添加、修改分类
  addOrEditCategory(tag) {
    return request({
      url: `/admin/category`,
      method: 'post',
      //把对象转换为json格式
      data: tag
    })
  },
  //删除分类
  deleteCategory(id) {
    return request({
      url: `/admin/category/${id}`,
      method: 'delete',
    })
  },
  //获取分类列表(前端)，只有id和name
  categoryList() {
    return request({
      url: `/categories`,
      method: 'get',
    })
  },
  //获取分类列表(后端)
  categoryBackList(condition) {
    return request({
      url: `/admin/categories`,
      method: 'post',
      data: condition
    })
  },
}